import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Header from "../views/common/Header";
import Footer from "../views/common/Footer";

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Home',
        components: {
            default: Home,
            start: Header,
            end: Footer
        }
    },
    {
        path: '/about',
        name: 'About',
        component: () => import('../views/About.vue')
    },
    {
        path: '/demo',
        name: 'Demo',
        components: {
            default: () => import('../views/Demo.vue'),
            start: Header,
            end: Footer
        }
    },
    {
        path: '/param',
        name: 'Param',
        component: function () {
            return import('../views/Param.vue')
        },
        children: [
            {
                path: 'id',
                name: 'Param',
                component: function () {
                    return import('../views/Param.vue')
                }
            }
        ]
    },
    {
        path: '/task',
        name: "Task",
        component: () => import('../views/task/Index'),
        children: [
            {
                path: 'list',
                name: 'TaskList',
                component: () => import('../views/task/TaskList'),
            },
            {
                path: 'log',
                name: 'TaskLog',
                component: () => import('../views/task/TaskLog'),
            }
        ]
    }


]

const router = new VueRouter({
    routes
})

export default router
